/*
 * @Description: 角色管理
 * @Author: HuiSir<273250950@qq.com>
 * @Date: 2021-10-15 15:10:44
 * @LastEditTime: 2025-08-14 18:58:19
 */
import { useProjectConfig, rules2MockMethods } from "./_helpers";
const project = useProjectConfig();
const Prefix = "/role/";

const roles = [
  {
    id: "001",
    name: "超级管理员",
    code: "admin",
    status: "@integer(0, 1)",
    delFlag: "@integer(0, 1)",
    description: "",
    createTime: "@datetime",
    updateTime: "@datetime",
    createUser: "@name",
    updateUser: "@name",
  },
  {
    id: "002",
    name: "游客",
    code: "visitor",
    status: "@integer(0, 1)",
    delFlag: "@integer(0, 1)",
    description: "",
    createTime: "@datetime",
    updateTime: "@datetime",
    createUser: "@name",
    updateUser: "@name",
  },
  {
    id: "003",
    name: "测试",
    code: "test",
    status: "@integer(0, 1)",
    delFlag: "@integer(0, 1)",
    description: "",
    createTime: "@datetime",
    updateTime: "@datetime",
    createUser: "@name",
    updateUser: "@name",
  },
  {
    id: "004",
    name: "运营",
    code: "op",
    status: "@integer(0, 1)",
    delFlag: "@integer(0, 1)",
    description: "",
    createTime: "@datetime",
    updateTime: "@datetime",
    createUser: "@name",
    updateUser: "@name",
  },
  {
    id: "005",
    name: "开发",
    code: "dev",
    status: "@integer(0, 1)",
    delFlag: "@integer(0, 1)",
    description: "",
    createTime: "@datetime",
    updateTime: "@datetime",
    createUser: "@name",
    updateUser: "@name",
  },
];

// 查所有角色
const getList = {
  [project.responseFields.data]: roles,
};

// 查询角色分页
const pageList = {
  [project.responseFields.data]: {
    [project.responseDataSubFields.records]: roles,
    page: 1,
    limit: 10,
    [project.responseDataSubFields.total]: 100,
    pageSize: 10,
  },
};

// 更新角色
const update = { [project.responseFields.message]: "保存成功" };

// 新增角色
const add = { [project.responseFields.message]: "新增成功" };

// 删除角色
const delRole = { [project.responseFields.message]: "删除成功" };

const Rules: Record<string, unknown> = {
  getList,
  pageList,
  update,
  add,
  delete: delRole,
};

export default rules2MockMethods(Rules, Prefix);
